﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:node="clr-namespace:XmlStudio.ViewModel.Node"
                    xmlns:vm="clr-namespace:XmlStudio.ViewModel"
                    xmlns:uc="clr-namespace:XmlStudio.Resources.UserControls" 
                    xmlns:loc="clr-namespace:Tomers.WPF.Localization;assembly=Tomers.WPF.Localization"
                    xmlns:Fluent="clr-namespace:Fluent;assembly=Fluent">
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="pack://application:,,,/Resources/Converters.xaml" />
    </ResourceDictionary.MergedDictionaries>

    <DataTemplate x:Key="XmlAttributeViewModelTemplate">
        <StackPanel Orientation="Horizontal">
            <TextBlock Text="{Binding Prefix}" Height="{StaticResource TextBlockHeight}" />
            <TextBlock Text=":" Height="{StaticResource TextBlockHeight}" />
            <TextBlock Text="{Binding LocalName}"  Height="{StaticResource TextBlockHeight}"/>
            <TextBlock Text=" = " Height="{StaticResource TextBlockHeight}" />
            <TextBox Text="{Binding Value}" MinWidth="100" Height="{StaticResource TextBoxHeight}" />
            <Button HorizontalAlignment="Right" BorderThickness="0" Background="Transparent" Width="15" Height="15" 
                    Command="uc:UcAttributes.RemoveAttribute" CommandParameter="{Binding}">
                <Image Source="pack://application:,,,/Icons/edit_remove.ico" />
            </Button>
        </StackPanel>
    </DataTemplate>

    <DataTemplate x:Key="XsdAttributeViewModelTemplate">
        <StackPanel Orientation="Horizontal">
            <TextBlock Text="{Binding Prefix}" Height="{StaticResource TextBlockHeight}" MinWidth="15" />
            <TextBlock Text=":" Height="{StaticResource TextBlockHeight}" />
            <TextBlock Text="{Binding LocalName}" Height="{StaticResource TextBlockHeight}" MinWidth="50" />
            <!--<TextBlock Text=" = " Height="{StaticResource TextBlockHeight}" />-->
            <TextBox Text="{Binding Value, ValidatesOnDataErrors=True, NotifyOnValidationError=True}" MinWidth="100" Margin="{StaticResource TextBoxMargin}" 
                     Height="{StaticResource TextBoxHeight}" IsReadOnly="True" />
            <Button HorizontalAlignment="Right" BorderThickness="0" Background="Transparent" Width="15" Height="15" 
                    Command="uc:UcXsdAttributes.EditAttribute" CommandParameter="{Binding}">
                <Image Source="pack://application:,,,/Icons/edit.ico" />
            </Button>
            <Button HorizontalAlignment="Right" BorderThickness="0" Background="Transparent" Width="15" Height="15" 
                    Command="uc:UcXsdAttributes.RemoveAttribute" CommandParameter="{Binding}" Visibility="{Binding Required, Converter={StaticResource boolToVisibilityNegativeConverter}}">
                <Image Source="pack://application:,,,/Icons/edit_remove.ico" />
            </Button>
        </StackPanel>
    </DataTemplate>

    <MenuItem x:Key="ChangeBackgroundSharedMenuItem" loc:Translate.Uid="ContextMenu.Shared.ChangeBackground" Header="{loc:Translate 'Change colors'}" 
              Command="vm:XmlViewModel.ChangeColorCommand" CommandParameter="{Binding}" x:Shared="False" CommandTarget="{Binding Path=CommandTarget}" />
    <MenuItem x:Key="ChangeAppearanceSharedMenuItem" loc:Translate.Uid="ContextMenu.Share.ChangeAppearance" Header="{loc:Translate 'Change shape'}"
              Command="vm:XmlViewModel.ChangeAppearanceCommand" CommandParameter="{Binding}" x:Shared="False" CommandTarget="{Binding Path=CommandTarget}" />
    <MenuItem x:Key="SelectSubtreeForCopyingMenuItem" loc:Translate.Uid="ContextMenu.Shared.SelectSubtreeForCopying" Header="{loc:Translate 'Copy'}"
               Command="vm:XmlViewModel.SelectSubtreeForCopyingCommand" CommandParameter="{Binding}" x:Shared="False" CommandTarget="{Binding Path=CommandTarget}" />
    <MenuItem x:Key="SelectSubtreeForMovingMenuItem" loc:Translate.Uid="ContextMenu.Shared.SelectSubtreeForMoving" Header="{loc:Translate 'Cut'}"
               Command="vm:XmlViewModel.SelectSubtreeForMovingCommand" CommandParameter="{Binding}" x:Shared="False" CommandTarget="{Binding Path=CommandTarget}" />
    <MenuItem x:Key="PasteSubtreeMenuItem" loc:Translate.Uid="ContextMenu.Shared.PasteSubtree" Header="{loc:Translate 'Paste'}"
               Command="vm:XmlViewModel.PasteSubtreeCommand" CommandParameter="{Binding}" x:Shared="False" CommandTarget="{Binding Path=CommandTarget}" />
    <MenuItem x:Key="EditSharedMenuItem" loc:Translate.Uid="xmlElementViewModelContextMenu.Edit" Header="{loc:Translate Edit}" x:Shared="False" 
                  Command="vm:XmlViewModel.EditXmlElementCommand" CommandParameter="{Binding}" CommandTarget="{Binding Path=CommandTarget}" />
    <MenuItem x:Key="EditXsdSharedMenuItem" loc:Translate.Uid="xsdElementViewModelContextMenu.Edit" Header="{loc:Translate Edit}" x:Shared="False" 
                  Command="vm:XsdViewModel.EditXsdElementCommand" CommandParameter="{Binding EditParam}" CommandTarget="{Binding Path=CommandTarget}" />
    <MenuItem x:Key="RemoveNodeSharedMenutItem" loc:Translate.Uid="xsdElementViewModelContextMenu.RemoveNode" Header="{loc:Translate Remove}" x:Shared="False"
                  Command="vm:XmlViewModel.RemoveNodeCommand" CommandParameter="{Binding}" CommandTarget="{Binding Path=CommandTarget}" />
    <MenuItem x:Key="ExpandWithSubtreeSharedMenuItem" loc:Translate.Uid="xsdElementViewModelContextMenu.ExpandWithSubtree" Header="{loc:Translate 'Expand with subtree'}"
                  Command="vm:XmlViewModel.ExpandNodeWithSubtreeCommand" CommandParameter="{Binding}" CommandTarget="{Binding Path=CommandTarget}" x:Shared="False" />
    <MenuItem x:Key="AddChildXsdElementSharedMenuItem" loc:Translate.Uid="xsdElementViewModelContextMenu.AddChildXsdElement" Header="{loc:Translate 'Add child xsd element'}"
                  x:Shared="False" />


    <DataTemplate x:Key="XmlAttributeViewModelReadOnlyTemplate">
        <StackPanel Orientation="Horizontal">
            <TextBlock Text="{Binding Prefix}" />
            <TextBlock Text=":" />
            <TextBlock Text="{Binding LocalName}" />
            <TextBlock Text=" = " />
            <TextBlock Text="{Binding Value}" />
        </StackPanel>
    </DataTemplate>

    <ContextMenu x:Key="xmlElementViewModelContextMenu">
        <MenuItem loc:Translate.Uid="xmlElementViewModelContextMenu.Edit" Header="{loc:Translate Edit}" 
                  Command="vm:XmlViewModel.EditXmlElementCommand" CommandParameter="{Binding}" CommandTarget="{Binding Path=CommandTarget}" />
        <MenuItem loc:Translate.Uid="xmlElementViewModelContextMenu.AddChildElement" Header="{loc:Translate 'Add child element'}" 
                  Command="vm:XmlViewModel.AddChildElementCommand" CommandParameter="{Binding}" CommandTarget="{Binding Path=CommandTarget}" />
        <MenuItem loc:Translate.Uid="xmlElementViewModelContextMenu.AddChildTextNode" Header="{loc:Translate 'Add child text node'}" 
                  Command="vm:XmlViewModel.AddChildTextNodeCommand" CommandParameter="{Binding}" CommandTarget="{Binding Path=CommandTarget}" />
        <MenuItem loc:Translate.Uid="xmlElementViewModelContextMenu.RemoveNode" Header="{loc:Translate Remove}" 
                  Command="vm:XmlViewModel.RemoveNodeCommand" CommandParameter="{Binding}" CommandTarget="{Binding Path=CommandTarget}" />
        <MenuItem loc:Translate.Uid="xmlElementViewModelContextMenu.ExpandWithSubtree" Header="{loc:Translate 'Expand with subtree'}"
                  Command="vm:XmlViewModel.ExpandNodeWithSubtreeCommand" CommandParameter="{Binding}" CommandTarget="{Binding Path=CommandTarget}" />
        <StaticResource ResourceKey="ChangeBackgroundSharedMenuItem" />
        <StaticResource ResourceKey="ChangeAppearanceSharedMenuItem" />
        <StaticResource ResourceKey="SelectSubtreeForCopyingMenuItem" />
        <StaticResource ResourceKey="SelectSubtreeForMovingMenuItem" />
        <StaticResource ResourceKey="PasteSubtreeMenuItem" />
    </ContextMenu>

    <ContextMenu x:Key="xsdElementViewModelContextMenu">
        <StaticResource ResourceKey="EditSharedMenuItem" />
        <StaticResource ResourceKey="RemoveNodeSharedMenutItem" />
        <StaticResource ResourceKey="ExpandWithSubtreeSharedMenuItem" />
        <StaticResource ResourceKey="ChangeBackgroundSharedMenuItem" />
        <StaticResource ResourceKey="ChangeAppearanceSharedMenuItem" />
        <StaticResource ResourceKey="SelectSubtreeForCopyingMenuItem" />
        <StaticResource ResourceKey="SelectSubtreeForMovingMenuItem" />
        <StaticResource ResourceKey="PasteSubtreeMenuItem" />
    </ContextMenu>

    <ContextMenu x:Key="xmlTextNodeViewModelContextMenu">
        <MenuItem loc:Translate.Uid="xmlTextNodeViewModelContextMenu.Edit" Header="{loc:Translate Edit}" 
                  Command="vm:XmlViewModel.EditTextNodeCommand" CommandParameter="{Binding}" CommandTarget="{Binding Path=CommandTarget}" />
        <MenuItem loc:Translate.Uid="xmlElementViewModelContextMenu.RemoveNode" Header="{loc:Translate Remove}" 
                  Command="vm:XmlViewModel.RemoveNodeCommand" CommandParameter="{Binding}" CommandTarget="{Binding Path=CommandTarget}" />
        <StaticResource ResourceKey="ChangeBackgroundSharedMenuItem" />
        <StaticResource ResourceKey="ChangeAppearanceSharedMenuItem" />
        <StaticResource ResourceKey="SelectSubtreeForCopyingMenuItem" />
        <StaticResource ResourceKey="SelectSubtreeForMovingMenuItem" />
        <StaticResource ResourceKey="PasteSubtreeMenuItem" />
    </ContextMenu>

    <ContextMenu x:Key="DesignerCanvasContextMenu">
        <MenuItem loc:Translate.Uid="DesignerCanvasContextMenu.CreateRootElement" Header="{loc:Translate 'Create root element'}" 
                         Command="vm:XmlViewModel.CreateRootElementCommand"  CommandTarget="{Binding Path=CommandTarget}" />
        <MenuItem loc:Translate.Uid="DesignerCanvasContextMenu.ExpandAll" Header="{loc:Translate 'Expand all'}" 
                         Command="vm:XmlViewModel.ExpandAllCommand" CommandTarget="{Binding Path=CommandTarget}" />
    </ContextMenu>

    <ContextMenu x:Key="DesignerCanvasContextMenuXsd">
        <MenuItem loc:Translate.Uid="DesignerCanvasContextMenu.CreateRootElement" Header="{loc:Translate 'Create schema element'}" 
                         Command="vm:XsdViewModel.CreateXsdElementCommand" CommandTarget="{Binding Path=CommandTarget}" />
        <MenuItem loc:Translate.Uid="DesignerCanvasContextMenu.ExpandAll" Header="{loc:Translate 'Expand all'}" 
                         Command="vm:XmlViewModel.ExpandAllCommand" CommandTarget="{Binding Path=CommandTarget}" />
    </ContextMenu>

    <Path x:Name="Path_58" x:Key="Path_58" x:Shared="False" Stretch="Fill" Fill="#FF000000" Data="F1 M 610.68,232.403L 592.412,214.134C 591.77,213.492 590.807,213.3 589.968,213.648C 589.131,213.995 588.584,214.812 588.584,215.72L 588.584,252.257C 588.584,253.164 589.131,253.981 589.968,254.328C 590.247,254.444 590.538,254.498 590.826,254.498C 591.41,254.498 591.983,254.272 592.412,253.844L 610.68,235.573C 611.098,235.156 611.338,234.578 611.338,233.988C 611.338,233.398 611.098,232.82 610.68,232.403 Z "/>

    <!--Width="11.3767" Height="20.51095"-->

    <DataTemplate DataType="{x:Type node:XmlElementViewModel}">
        <Border Background="Transparent" ContextMenu="{StaticResource xmlElementViewModelContextMenu}" Padding="10">
            <Grid>
                <Grid.ToolTip>
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition />
                            <RowDefinition />
                            <RowDefinition />
                        </Grid.RowDefinitions>

                        <Grid.ColumnDefinitions>
                            <ColumnDefinition />
                            <ColumnDefinition />
                        </Grid.ColumnDefinitions>

                        <TextBlock loc:Translate.Uid="XmlElementViewModel.ToolTip.Prefix" Text="{loc:Translate 'Prefix:'}" Margin="2" />
                        <TextBlock loc:Translate.Uid="XmlElementViewModel.ToolTip.LocalName" Text="{loc:Translate 'LocalName:'}" Grid.Row="1" Margin="2" />
                        <TextBlock loc:Translate.Uid="XmlElementViewModel.ToolTip.NamespaceURI" Text="{loc:Translate 'NamespaceURI:'}" Grid.Row="2" Margin="2" />

                        <TextBlock Text="{Binding Prefix}" Grid.Column="1" Margin="2" />
                        <TextBlock Text="{Binding LocalName}" Grid.Column="1" Grid.Row="1" Margin="2" />
                        <TextBlock Text="{Binding NamespaceURI}" Grid.Column="1" Grid.Row="2" Margin="2" />
                    </Grid>
                </Grid.ToolTip>
                <Grid.RowDefinitions>
                    <RowDefinition />
                    <RowDefinition />
                </Grid.RowDefinitions>
                <Grid Grid.Row="0">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="*" />
                    </Grid.ColumnDefinitions>
                    <Button x:Name="ButtonMoveLeft" Grid.Column="0" Width="12" Height="15" Background="Transparent" Command="vm:XmlViewModel.MoveNodeLeftCommand" CommandParameter="{Binding}">
                        <Border>
                            <Border.LayoutTransform>
                                <RotateTransform Angle="180" />
                            </Border.LayoutTransform>
                            <StaticResource ResourceKey="Path_58" />
                        </Border>
                    </Button>
                    <Button x:Name="ButtonExpand" Grid.Column="1" BorderThickness="0" Background="Transparent" Width="15" Height="15" Command="vm:XmlViewModel.ExpandNodeCommand" CommandParameter="{Binding}" 
                    Visibility="{Binding State, Converter={StaticResource ExpandButtonVisibilityConverter}}">
                        <Image Source="pack://application:,,,/Icons/edit_add.ico" />
                    </Button>
                    <Button x:Name="ButtonCollapse" Grid.Column="2" BorderThickness="0" Background="Transparent" Width="15" Height="15" Command="vm:XmlViewModel.CollapseNodeCommand" CommandParameter="{Binding}" 
                    Visibility="{Binding State, Converter={StaticResource CollapseButtonVisibilityConverter}}">
                        <Image Source="pack://application:,,,/Icons/edit_remove.ico" />
                    </Button>
                    <Button x:Name="ButtonMoveRight" Grid.Column="3" Width="12" Height="15" Background="Transparent" Command="vm:XmlViewModel.MoveNodeRightCommand" CommandParameter="{Binding}">
                        <Border>
                            <StaticResource ResourceKey="Path_58" />
                        </Border>
                    </Button>
                </Grid>
                <Expander Grid.Row="1">
                    <Expander.Header>
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="*" />
                            </Grid.ColumnDefinitions>
                            <TextBlock Text="*" Grid.Column="0" Visibility="{Binding IsModified, Converter={StaticResource boolToVisibilityPositiveConverter}}" />
                            <TextBlock Grid.Column="1" Text="{Binding Name, Mode=OneWay}" Margin="2" />
                        </Grid>
                    </Expander.Header>
                    <StackPanel Orientation="Vertical">
                        <uc:UcAttributes Attributes="{Binding Attributes, Mode=TwoWay}" ReadOnly="True" ItemTemplate="{StaticResource XmlAttributeViewModelReadOnlyTemplate}" />
                        <Button x:Name="saveButton" Content="Save" Command="vm:XmlViewModel.SaveXmlElementCommand" CommandParameter="{Binding}" 
                            Visibility="{Binding IsModified, Converter={StaticResource boolToVisibilityPositiveConverter}}" />
                    </StackPanel>
                </Expander>
            </Grid>
        </Border>
        <DataTemplate.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter Property="Visibility" TargetName="ButtonMoveLeft" Value="Visible" />
                <Setter Property="Visibility" TargetName="ButtonMoveRight" Value="Visible" />
                <!--<Setter Property="Visibility" TargetName="ButtonExpand" Value="Visible" />
                <Setter Property="Visibility" TargetName="ButtonCollapse" Value="Visible" />-->
            </Trigger>
            <Trigger Property="IsMouseOver" Value="False">
                <Setter Property="Visibility" TargetName="ButtonMoveLeft" Value="Hidden" />
                <Setter Property="Visibility" TargetName="ButtonMoveRight" Value="Hidden" />
                <Setter Property="Visibility" TargetName="ButtonExpand" Value="Hidden" />
                <Setter Property="Visibility" TargetName="ButtonCollapse" Value="Hidden" />
            </Trigger>
        </DataTemplate.Triggers>
    </DataTemplate>

    <DataTemplate DataType="{x:Type node:XsdElementViewModel}">
        <Border Background="Transparent" Padding="10" ContextMenu="{Binding ContextMenu}">
            <Grid>
                <Grid.ToolTip>
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition />
                            <RowDefinition />
                            <RowDefinition />
                        </Grid.RowDefinitions>

                        <Grid.ColumnDefinitions>
                            <ColumnDefinition />
                            <ColumnDefinition />
                        </Grid.ColumnDefinitions>

                        <TextBlock loc:Translate.Uid="XmlElementViewModel.ToolTip.Prefix" Text="{loc:Translate 'Prefix:'}" Margin="2" />
                        <TextBlock loc:Translate.Uid="XmlElementViewModel.ToolTip.LocalName" Text="{loc:Translate 'LocalName:'}" Grid.Row="1" Margin="2" />
                        <TextBlock loc:Translate.Uid="XmlElementViewModel.ToolTip.NamespaceURI" Text="{loc:Translate 'NamespaceURI:'}" Grid.Row="2" Margin="2" />

                        <TextBlock Text="{Binding Prefix}" Grid.Column="1" Margin="2" />
                        <TextBlock Text="{Binding LocalName}" Grid.Column="1" Grid.Row="1" Margin="2" />
                        <TextBlock Text="{Binding NamespaceURI}" Grid.Column="1" Grid.Row="2" Margin="2" />
                    </Grid>
                </Grid.ToolTip>
                <Grid.RowDefinitions>
                    <RowDefinition />
                    <RowDefinition />
                </Grid.RowDefinitions>
                <Grid Grid.Row="0">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="*" />
                    </Grid.ColumnDefinitions>
                    <Button x:Name="ButtonMoveLeft" Grid.Column="0" Width="12" Height="15" Background="Transparent" Command="vm:XmlViewModel.MoveNodeLeftCommand" CommandParameter="{Binding}">
                        <Border>
                            <Border.LayoutTransform>
                                <RotateTransform Angle="180" />
                            </Border.LayoutTransform>
                            <StaticResource ResourceKey="Path_58" />
                        </Border>
                    </Button>
                    <Button x:Name="ButtonExpand" Grid.Column="1" BorderThickness="0" Background="Transparent" Width="15" Height="15" Command="vm:XmlViewModel.ExpandNodeCommand" CommandParameter="{Binding}" 
                    Visibility="{Binding State, Converter={StaticResource ExpandButtonVisibilityConverter}}">
                        <Image Source="pack://application:,,,/Icons/edit_add.ico" />
                    </Button>
                    <Button x:Name="ButtonCollapse" Grid.Column="2" BorderThickness="0" Background="Transparent" Width="15" Height="15" Command="vm:XmlViewModel.CollapseNodeCommand" CommandParameter="{Binding}" 
                    Visibility="{Binding State, Converter={StaticResource CollapseButtonVisibilityConverter}}">
                        <Image Source="pack://application:,,,/Icons/edit_remove.ico" />
                    </Button>
                    <Button x:Name="ButtonMoveRight" Grid.Column="3" Width="12" Height="15" Background="Transparent" Command="vm:XmlViewModel.MoveNodeRightCommand" CommandParameter="{Binding}">
                        <Border>
                            <StaticResource ResourceKey="Path_58" />
                        </Border>
                    </Button>
                </Grid>
                <Expander Grid.Row="1">
                    <Expander.Header>
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="*" />
                            </Grid.ColumnDefinitions>
                            <TextBlock Text="*" Grid.Column="0" Visibility="{Binding IsModified, Converter={StaticResource boolToVisibilityPositiveConverter}}" />
                            <TextBlock Grid.Column="1" Text="{Binding Name, Mode=OneWay}" Margin="2" />
                        </Grid>
                    </Expander.Header>
                    <StackPanel Orientation="Vertical">
                        <uc:UcAttributes Attributes="{Binding Attributes, Mode=TwoWay}" ReadOnly="True" ItemTemplate="{StaticResource XmlAttributeViewModelReadOnlyTemplate}" />
                        <Button x:Name="saveButton" Content="Save" Command="vm:XmlViewModel.SaveXmlElementCommand" CommandParameter="{Binding}" 
                            Visibility="{Binding IsModified, Converter={StaticResource boolToVisibilityPositiveConverter}}" />
                    </StackPanel>
                </Expander>
            </Grid>
        </Border>
        <DataTemplate.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter Property="Visibility" TargetName="ButtonMoveLeft" Value="Visible" />
                <Setter Property="Visibility" TargetName="ButtonMoveRight" Value="Visible" />
            </Trigger>
            <Trigger Property="IsMouseOver" Value="False">
                <Setter Property="Visibility" TargetName="ButtonMoveLeft" Value="Hidden" />
                <Setter Property="Visibility" TargetName="ButtonMoveRight" Value="Hidden" />
                <Setter Property="Visibility" TargetName="ButtonExpand" Value="Hidden" />
                <Setter Property="Visibility" TargetName="ButtonCollapse" Value="Hidden" />
            </Trigger>
        </DataTemplate.Triggers>
    </DataTemplate>

    <DataTemplate DataType="{x:Type node:XmlTextViewModel}">
        <Border Background="Transparent" ContextMenu="{StaticResource xmlTextNodeViewModelContextMenu}" Padding="10">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition />
                    <RowDefinition />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>
                <Button x:Name="ButtonMoveLeft" Grid.Column="0" Width="12" Height="15" Background="Transparent" Command="vm:XmlViewModel.MoveNodeLeftCommand" CommandParameter="{Binding}">
                    <Border>
                        <Border.LayoutTransform>
                            <RotateTransform Angle="180" />
                        </Border.LayoutTransform>
                        <StaticResource ResourceKey="Path_58" />
                    </Border>
                </Button>
                <Button x:Name="ButtonMoveRight" Grid.Column="2" Width="12" Height="15" Background="Transparent" Command="vm:XmlViewModel.MoveNodeRightCommand" CommandParameter="{Binding}">
                    <Border>
                        <StaticResource ResourceKey="Path_58" />
                    </Border>
                </Button>

                <TextBlock Name="xmlcode" Grid.Row="1" Grid.ColumnSpan="3" Text="{Binding Text}" TextWrapping="Wrap" MaxWidth="250" />
            </Grid>
        </Border>
        <DataTemplate.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter Property="Visibility" TargetName="ButtonMoveLeft" Value="Visible" />
                <Setter Property="Visibility" TargetName="ButtonMoveRight" Value="Visible" />
                <!--<Setter Property="Visibility" TargetName="ButtonExpand" Value="Visible" />
                <Setter Property="Visibility" TargetName="ButtonCollapse" Value="Visible" />-->
            </Trigger>
            <Trigger Property="IsMouseOver" Value="False">
                <Setter Property="Visibility" TargetName="ButtonMoveLeft" Value="Hidden" />
                <Setter Property="Visibility" TargetName="ButtonMoveRight" Value="Hidden" />
            </Trigger>
        </DataTemplate.Triggers>
    </DataTemplate>
</ResourceDictionary>